package com.shortlink.openserver.controller;

import com.shortlink.openserver.service.OpenServerService;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * 短链接开放服务控制层
 *
 * @author wp
 */
@Controller
@RequiredArgsConstructor
public class OpenServerController {
    private final OpenServerService openServerService;

    @GetMapping("/{shortUri}")
    public void restoreUrl(@PathVariable String shortUri, HttpServletRequest request, HttpServletResponse response) {
        openServerService.restoreUrl(shortUri, request, response);
    }
}
